package com.christina.engine.context.model;

import lombok.Data;
import lombok.Builder;
import java.time.LocalDateTime;
import java.util.Map;
import java.util.List;

/**
 * 用户上下文模型
 * 
 * @author Christina
 */
@Data
@Builder(toBuilder = true)
public class UserContext {
    
    /**
     * 用户ID
     */
    private Long userId;
    
    /**
     * 用户名
     */
    private String username;
    
    /**
     * 邮箱
     */
    private String email;
    
    /**
     * 角色
     */
    private String role;
    
    /**
     * 状态
     */
    private String status;
    
    /**
     * 最后活跃时间
     */
    private LocalDateTime lastActiveTime;
    
    /**
     * 属性
     */
    private Map<String, Object> attributes;
    
    /**
     * 用户基本信息
     */
    private UserProfile profile;
    
    /**
     * 用户偏好设置
     */
    private UserPreferences preferences;
    
    /**
     * 用户历史行为
     */
    private List<UserBehavior> behaviorHistory;
    
    /**
     * 上下文创建时间
     */
    private LocalDateTime createTime;
    
    /**
     * 上下文更新时间
     */
    private LocalDateTime updateTime;
    
    /**
     * 用户资料
     */
    @Data
    @Builder
    public static class UserProfile {
        private String username;
        private String nickname;
        private String email;
        private String phone;
        private String avatar;
        private String location;
        private String timezone;
        private String language;
    }
    
    /**
     * 用户偏好
     */
    @Data
    @Builder(toBuilder = true)
    public static class UserPreferences {
        // 通知偏好
        private Boolean notifications;
        private Boolean emailNotification;
        private Boolean pushNotification;
        // 基础偏好
        private String language;
        private String theme;
        private String timezone;
        private String notificationLevel;
        private Boolean soundEnabled;
        
        // 出行偏好
        private String preferredTransportMode;
        private String preferredSeatClass;
        private String budgetRange;
        
        // 聊天偏好
        private String chatStyle;
        private String responseLength;
        private Boolean aiSuggestionsEnabled;
        private String communicationStyle;
        
        // 隐私和安全偏好
        private String privacyLevel;
        private Integer dataRetentionDays;
        private Boolean autoSave;
        
        // 快捷键和自定义偏好
        private Map<String, String> shortcuts;
        private Map<String, Object> customPreferences;
    }
    
    /**
     * 用户行为
     */
    @Data
    @Builder
    public static class UserBehavior {
        private String actionType;
        private String actionTarget;
        private Map<String, Object> actionData;
        private LocalDateTime timestamp;
        private String result;
    }
}